﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using AutoCorrelatorGUI.ViewModel;

namespace AutoCorrelatorGUI.View
{
   /// <summary>
   /// Interaction logic for WellListView.xaml
   /// </summary>
   public partial class WellListView : UserControl
   {
      public WellListView()
      {
         InitializeComponent();

         if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
         {
            Background = Brushes.Transparent;
         }
      }

      private void CheckBox_Checked(object sender, RoutedEventArgs e)
      {
         WellListViewModel mvm = DataContext as WellListViewModel;

         //Make sure the sender was one of the selected
         if (mvm.InternalWellData.SelectedItems.Contains((sender as FrameworkElement).DataContext as WellVM))
         {
            mvm.GroupWellSelect(true);
         }
      }

      private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
      {
         WellListViewModel mvm = DataContext as WellListViewModel;

         //Make sure the sender was one of the selected
         if (mvm.InternalWellData.SelectedItems.Contains((sender as FrameworkElement).DataContext as WellVM))
         {
            mvm.GroupWellSelect(false);
         }
      }
   }
}
